# coding:utf-8
import socket


def main():
    host = 'localhost'
    port = 9000
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host, port))
    while True:
        msg = bytes(input('>>'), encoding='utf8')
        s.sendall(msg)
        data = s.recv(1024)

        print('Received', repr(data))

    s.close()
    pass


if __name__ == '__main__':
    main()